<%--
功能：显示内容目录图片
--%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

 
<%@ tag import="org.springframework.context.ApplicationContext" %>
<%@ tag import="org.springframework.web.context.support.WebApplicationContextUtils" %>
<%@ tag import="com.probiz.estore.catalog.service.ContentCategoryManager" %>
<%@ tag import="com.probiz.estore.common.model.catalog.ContentCategory" %>

<%@ attribute name="width" %>
<%@ attribute name="height" %>
<%@ attribute name="style" %>
<%@ attribute name="id" %>
<%@ attribute name="alt" %>
<%@ attribute name="onmouseover" %>
<%@ attribute name="onclick" %>
<%@ attribute name="noLink" description="true 表示图片上有超连接"%>
<%@ attribute name="category" type="com.probiz.estore.common.model.catalog.ContentCategory" required="false" description="目录"%>
<%@ attribute name="categoryId" type="java.lang.Integer" required="false" description="目录id 如果category 无指定,则可用这个"%>
<%@ attribute name="categoryCode" type="java.lang.String" required="false" description="目录categoryCode.如果category,categoryId无指定，则必须制定categoryCode" %>

<%
	ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(session.getServletContext());
	ContentCategoryManager contentCategoryManager = (ContentCategoryManager) ctx.getBean("contentCategoryManager");
	ContentCategory targetContentCategory = category;
	if(null == targetContentCategory){
		if(null != categoryId){
			targetContentCategory = contentCategoryManager.getById(categoryId);
		}else{
			targetContentCategory = contentCategoryManager.getCategoryByCode(categoryCode);
		}
	}	
	request.setAttribute("targetContentCategory",targetContentCategory);
%>

<c:if test="${empty noLink}"><a <catalog:contentCategoryLink categoryId="${targetContentCategory.categoryId}"/> ></c:if>
<img src="${mediaPath}${targetContentCategory.imageUrl}" onerror="this.src=__defaultImage_mn;this.onerror='';" originsrc=""
<c:if test="${not empty width}">width="${width}"</c:if>
<c:if test="${not empty height}">height="${height}"</c:if>
<c:if test="${not empty style}">style="${style}"</c:if>
<c:if test="${not empty id}">id="${id}"</c:if>
<c:if test="${not empty alt}">alt="${alt}"</c:if>
<c:if test="${not empty onmouseover}">onmouseover="${onmouseover}" </c:if>
<c:if test="${not empty onclick}">onclick="${onclick}" </c:if> />
<c:if test="${empty noLink}"></a></c:if>